package com.yyq.adms.usermanage.bpo.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.yyq.adms.usermanage.bpo.SysRolesBpo;
import com.yyq.adms.usermanage.dao.SysRolesDao;
import com.yyq.adms.usermanage.pojo.SysUsers;
import com.yyq.sos.service.BaseBpoImpl;

@Transactional
@Service("sysRolesBpo")
public class SysRolesBpoImpl extends BaseBpoImpl implements SysRolesBpo {

	private SysRolesDao dao;
	
	@Resource(name="sysRolesDao")
	public void setDao(SysRolesDao dao) {
		this.dao = dao;
		this.setBaseDao(dao);
	}

	/**
	 * 用户登录
	 */
	@Transactional(readOnly=true)
	public SysUsers login(SysUsers vo)
	{
		SysUsers obj = (SysUsers)dao.findByPk("from "+SysUsers.class.getName()+" where userName='"+vo.getUserName()+"'");
		if(obj == null)
			return null;
		else{
			if(obj.getPassword().equals(vo.getPassword()))
				return obj;
			else
				return null;
		}
	}
}
